import api from './api'

class PaymentApi extends api {
  /**
   * 创建支付信息
   *
   * @param {*} targetId 订单id
   * @param {*} payType 支付类型
   * @param {*} businessType 业务类型
   */
  createPayment (targetId, payType, businessType) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/createPayment/${businessType}`,
      method: 'post',
      data: {
        targetId,
        payType
      }
    })
  }

  /**
   * 查询支付结果
   * @param {*} id 业务id
   * @param {*} businessType 业务类型
   */
  queryPayment (id, businessType) {
    return this.request({
      url: `${this.servicePath}/${this.modulePath}/queryResult/${businessType}/${id}`,
      method: 'get',
      showLoading: false
    })
  }
}

export default new PaymentApi('pay')
